#!/bin/sh

VERSION=2

. /usr/share/univention-lib/base.sh
. /usr/share/univention-lib/ldap.sh
. /usr/share/univention-join/joinscripthelper.lib
joinscript_init

eval "$(univention-config-registry shell)"

ucs_addServiceToLocalhost "Susan Backup" "$@"

ucs_registerLDAPExtension "$@" --schema /usr/share/univention-susan/univention-susan.schema

# keep "cn=custom attributes,cn=univention,$ldap_base" clean
univention-directory-manager container/cn create "$@" \
        --ignore_exists \
		--position "cn=custom attributes,cn=univention,$ldap_base" \
		--set name="susan" || die

# extend to more modules? domaincontroller_master?
univention-directory-manager settings/extended_attribute create "$@" \
	--ignore_exists \
	--position="cn=susan,cn=custom attributes,cn=univention,$ldap_base" \
	--set name=susan-enabled \
	--set module=computers/linux \
	--set module=computers/ubuntu \
	--set module=computers/windows \
	--set module=computers/ipmanagedclient \
	--set tabName="Susan Backup" \
	--set tabPosition=2 \
	--set ldapMapping="susanEnableJob" \
	--set objectClass="susanClientHost" \
	--set longDescription="schedule backup for this host (the susan client needs to be installed)" \
	--set shortDescription="enable backup job" \
	--set translationShortDescription='"de_DE" "Backup-Job aktivieren"' \
	--set translationLongDescription='"de_DE" "Backup für diesen Rechner durchführen (Susan-Client muss installiert sein)"' \
	--set CLIName=susan \
	--set mayChange=1 \
	--set syntax='OkOrNot' || die

joinscript_save_current_version

exit 0

